package com.gitee.dupe.authority.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.gitee.dolt.core.base.entity.Entity;
import com.gitee.dolt.model.RemoteData;
import com.gitee.dupe.authority.dto.UserRoleDTO;
import com.gitee.dupe.authority.enumeration.UserStateEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author LYH
 * @since 2020-06-30
 */
@Data
@Accessors(chain = true)
@TableName("b_user")
public class User extends Entity<Long> {

    /**
     * 账号（唯一）
     */
    @TableField(value = "account")
    private String account;

    /**
     * 密码
     */
    @TableField(value = "password_hash")
    @JsonIgnore
    private String passwordHash;

    /**
     * 真实姓名
     */
    @TableField(value = "real_name")
    private String realName;

    /**
     * 状态
     */
    @TableField(value = "state")
    private UserStateEnum state;

    /**
     * 手机号
     */
    @TableField(value = "mobile")
    private String mobile;

    /**
     * 邮箱
     */
    @TableField(value = "email")
    private String email;

    /**
     * 头像
     */
    @TableField(value = "avatar")
    private String avatar;

    /**
     * 用户分类
     */
    @TableField(value = "group_")
    private String group;

    /**
     * 组织架构
     */
    @TableField(value = "org_id")
    private RemoteData<Long, String> orgId;

    /**
     * 部门
     */
    @TableField(value = "department")
    private String department;

    @TableField(exist = false)
    @ApiModelProperty(value = "角色", accessMode = ApiModelProperty.AccessMode.READ_ONLY)
    private List<UserRoleDTO> roles;

}
